
package com.ffcs.crmd.tsp.admin.facade.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ctg.itrdc.platform.common.entity.PageInfo;
import com.ctg.itrdc.platform.common.utils.bean.BeanUtils;
import com.ffcs.crmd.platform.core.ddd.facade.impl.AbstractCrmDomFacade;
import com.ffcs.crmd.tsp.admin.api.dto.TaskConnectInfoDTO;
import com.ffcs.crmd.tsp.admin.api.facade.ITaskConnectInfoFacade;
import com.ffcs.crmd.tsp.admin.entity.TaskConnectInfo;
import com.ffcs.crmd.tsp.admin.service.ITaskConnectInfoService;

@Service("taskConnectInfoFacade")
public class TaskConnectInfoFacadeImpl extends AbstractCrmDomFacade implements ITaskConnectInfoFacade {
   	
   	@Autowired
	private ITaskConnectInfoService taskConnectInfoService;
	   
    
    private PageInfo<TaskConnectInfoDTO> copyPageInfo(PageInfo<TaskConnectInfo> pageInfo) throws Exception{
        PageInfo<TaskConnectInfoDTO> pageInfoDto = new PageInfo<TaskConnectInfoDTO>();
        BeanUtils.applyIf(pageInfoDto, pageInfo, false);
        pageInfoDto.setList(BeanUtils.copyList(pageInfo.getList(), TaskConnectInfoDTO.class));
        return pageInfoDto;
    }


    /**
     * 功能说明:
     * 
     * @param clusterName
     * @param jobName
     * @param pageNumber
     * @param pageSize
     * @return
     * @throws Exception
     */
    @Override
    public PageInfo<TaskConnectInfoDTO> queryPage(TaskConnectInfoDTO taskConnectInfoDTO) throws Exception {
        TaskConnectInfo taskConnectInfo = new TaskConnectInfo();
        BeanUtils.applyIf(taskConnectInfo, taskConnectInfoDTO, false);
        PageInfo<TaskConnectInfo> pageInfo = taskConnectInfoService.queryPage(taskConnectInfo, taskConnectInfoDTO.getPageNumber(), taskConnectInfoDTO.getPageSize());
        return copyPageInfo(pageInfo);
    }


    /**
     * 功能说明:
     * 
     * @param clusterName
     * @param jobName
     * @return
     * @throws Exception
     */
    @Override
    public List<TaskConnectInfoDTO> query(TaskConnectInfoDTO taskConnectInfoDTO) throws Exception {
        TaskConnectInfo taskConnectInfo = new TaskConnectInfo();
        BeanUtils.applyIf(taskConnectInfo, taskConnectInfoDTO, false);
        List<TaskConnectInfo> taskConnectInfoList = taskConnectInfoService.query(taskConnectInfo);
        return BeanUtils.copyList(taskConnectInfoList, TaskConnectInfoDTO.class);
    }
}
